package com.bbx.taxi.client.Task;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;

import com.bbx.androidapi.util.ToastUtil;
import com.bbx.api.sdk.model.passanger.CouponCountBuild;
import com.bbx.api.sdk.model.passanger.OrderSubmitBuild;
import com.bbx.api.sdk.net.base.BaseNetwork;
import com.bbx.api.sdk.net.passeger.conn.CouponCountNet;
import com.bbx.api.sdk.net.passeger.conn.OrderSubmitNet;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.R;
import com.bbx.taxi.client.Activity.Main.MainActivity;
import com.bbx.taxi.client.Activity.Main.MainActivity;
import com.bbx.taxi.client.Activity.Main.MainPresenter;
import com.bbx.taxi.client.Bean.Message.ObserverListener.DATA_TYPE;
import com.bbx.taxi.client.Util.IsSnQiangDan;
import com.bbx.taxi.client.widget.Dailog.MessageDialog;

/** 
 * @Path com.bbx.taxi.client.Task.MyOrderSubmitTask.java
 * @Author 严旭文
 * @Date 2016-8-24 上午11:35:09
 * @Company 蓝海（福建）信息技术有限公司
 * @Description
 */
public class MyOrderSubmitTask  extends BaseTask{
    public DATA_TYPE TYPE=DATA_TYPE.ORDERSUBMIT;
    private OrderSubmitBuild mOrderSubmitBuild;
    private MainActivity mainActivity;
	public MyOrderSubmitTask(Activity context,OrderSubmitBuild mOrderSubmitBuild) {
		super(context);
	    this.mOrderSubmitBuild=mOrderSubmitBuild;
	     mainActivity=(MainActivity)context;
	}
	@Override
	public boolean isShow() {
		return true;
	}

	@Override
	public boolean isReturnString() {
		return false;
	}
	@Override
	public boolean condition() {
		// TODO Auto-generated method stub
		return true;
	}
	@Override
	public void request() {
		setType(TYPE,mOrderSubmitBuild);
	}
	@Override
	public void success(int status,Object object) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void failed(int status, String msg,String message) {
		if (status == -10123) {
			MessageDialog.onSnQiangDanDialog((Activity)context,
					IsSnQiangDan.isIncludeSnLocal(context), true,
					message);	
			mainActivity.mHandler.sendEmptyMessage(MainPresenter.CONFIRM_NOCLICK);

		} else {
			// TODO Auto-generated method stub
			ToastUtil.showToast(context,
					context.getResources().getString(R.string.no_network));
			mainActivity.mHandler.sendEmptyMessage(MainPresenter.CONFIRM_NOCLICK);
		}

	
	}
	@Override
	public BaseNetwork getBaseNetwork() {
		return new OrderSubmitNet(context);
	}

}

